<% if @my_orders.length > 0 %>
<table cellspacing="10">
  <tr>
    <th>Restaurant </th>
    <th>Bounty </th>
    <th>Cost </th>
    <th>Destination </th>
    <th>Content </th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @my_orders.each do |order| %>
  <tr>
    <td><%= order.restaurant %></td>
    <td><%= number_to_currency(order.bounty) %></td>
    <td><%= number_to_currency(order.order_cost) %></td>
    <td><%= order.order_destination %></td>
    <td><%= truncate order.content, :length => 25 %></td>
    <td><%= link_to 'Show', order %></td>
    <% if !order.driver_id && !(order.delivery_failed || order.delivery_completed)  %>
    <td><%= link_to 'Edit', edit_order_path(order) %></td>
    <td><%= link_to 'Destroy', order, :confirm => 'Are you sure?', :method => :delete %></td>
    <% else %>
    <td></td>
    <td></td>
    <% end %>
    <% if order.delivery_failed %>
    <td>Delivery Failed</td>
    <% elsif order.delivery_completed %>
    <td>Delivery Sucessful</td>
    <% else %>
    <td><%= link_to 'Report Failed', failed_url(:id => order.id), :confirm => "Are you sure?" %></td>
    <% end %>
    <% if order.driver_feedback.length == 0 && (order.delivery_failed || order.delivery_completed) %>
    <td><%= link_to 'Leave Feedback', :controller => "orders", :action => "driver_feedback", :id => order.id %></td>
    <% elsif order.delivery_completed || order.delivery_failed %>
    <td><%= order.customer_feedback %></td>
    <% else %>
    <td></td>
    <% end %>
  </tr>
<% end %>
</table>
<% else %>
None yet.
<% end %>
